package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import com.atguigu.springcloud.service.FeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述
 *
 * @author ZhangKai
 * @version 1.0
 * @createDate 2025/2/27 14:28
 **/
@RestController
public class FeignController {

    @Autowired
    private FeignService feignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return  feignService.getPaymentById(id);
    }

    @GetMapping("/consumer/payment/feign/timeout/")
    public String getPaymentById(){
        //openFeign默认等待接口响应为 1s
        return  feignService.paymentFeignTimeout();
    }

}
